﻿using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Financial.Componentes
{
    internal sealed class InputCheckBoxField : CheckBoxField
    {
        public const string CHECKBOX_ID = "CheckBoxButton";

        public InputCheckBoxField() { }

        /// <summary>
        /// Método que inicializa um dataCell
        /// </summary>
        /// <param name="pCell"></param>
        /// <param name="pRowState"></param>
        protected override void InitializeDataCell(DataControlFieldCell pCell, DataControlRowState pRowState)
        {
            base.InitializeDataCell(pCell, pRowState);

            // Add a checkbox anyway, if not done already
            if (pCell.Controls.Count == 0)
            {
                CheckBox lCheckBox = new CheckBox();
                lCheckBox.ID = InputCheckBoxField.CHECKBOX_ID;
                lCheckBox.Style.Add(HtmlTextWriterStyle.BackgroundColor, "transparent");
                lCheckBox.Style.Add(HtmlTextWriterStyle.BorderWidth, "0");
                pCell.Controls.Add(lCheckBox);
            }
        }
    }
}
